home *** CD-ROM | disk | FTP | other *** search
- Path: mother.usf.edu!news
- From: yatesc@csee.usf.edu (Randy Yates)
- Newsgroups: comp.lang.c
- Subject: Re: 16bit vs. 32bit
- Date: 26 Mar 1996 22:40:09 GMT
- Organization: University of South Florida
- Message-ID: <4j9ro9$kor@mother.usf.edu>
- References: <4iui27$egk@news.netam.net> <4iunpm$c0n@crl.crl.com>
- NNTP-Posting-Host: ppp184.cfr.usf.edu
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.93.14
-
- In article <4iunpm$c0n@crl.crl.com>, bobfry@crl.com says...
- >
- >bgc@alpha.netam.net (The Bowling Green Connection) writes:
- >
- >>Could someone explain, technically, what 16bit and 32bit refers to?
- >>Is there a FAQ somewhere about it I could read?
- >
- >These are topics related to the Intel CPUs. You might get more
- >information from one of the msdos-specific or intel-specific newsgroups
- >(depending on your needs), but they refer to the two modes that have been
- >available on the 286, 386, 486, and Pentium. In 'protected' mode (or
- >32-bit mode), pointers are 32 bits long, with an optional 16 bit segment
- >descriptor that refers to a translation table in memory. In 16-bit mode,
- >pointers are 16 bits long, with an optional 16-bit segment address that
- >is in effect a paragraph address.
- >
- >With the newer compilers, you can switch between modes using a
- >compile-time switch. (Don't mix modes!). Windows NT (and Windows 95, I
- >think) use protected mode for their code and libraries. Windows 3.x uses
- >real (16 bit) mode. And the switch between the two modes is very slow.
- >
- > Bob
-
- Bob, your use of the term "protected mode" is slightly off here. Both
- Windows 3.x running in 386 Enhanced Mode and Windows 95 run in "protected
- modes" - it's just that one is "16-bit protected mode" and the other is
- "32-bit protected mode".
-
- To really know how memory works with the 80386 microprocessors and later, you
- need a short history lesson.
-
- In the old days (beginning around 1977, I think), Intel had the 8080
- microprocessor. This was an 8-bit processor, i.e., it had an 8-bit data
- bus and a 16-bit address bus. (The bus is the physical set of pins
- which access other peripheral devices such as RAM memory.) A year or
- two later, they came out with the 8085 uP, which was identical
- to the bus architecture of the 8080 but operated at faster speeds
- and had a few more assembly language instructions. The address space
- on these early processors was a very simple linear (or flat)
- space - one 16-bit word formed the address pointer and that is
- what pointed to physical memory. (Physical memory is memory
- that the processor can directly access with its address lines.)
- The maximum amount of physical memory you could address with
- these processors was 2^16 = 64 kbytes (1k = 1024 bytes).
-
- Then, circa about 1980, Intel came out with their first 16-bit
- microprocessor - the 8086. (The 8088, which is what the first
- IBM PC XT was based on, is almost identical to the 8086 except
- that the data bus interface was 8 bits instead of 16 - 16-bit
- I/O had to occur in two bus cycles. This reduced the
- cost of the supporting hardware a bit.) The important thing to
- note about the 8086/8088 is that its address bus was
- 20 bits long, and 2^20 = 1 Megabyte of memory was addressable.
- In other words, the maximum amount of physical memory you could
- address with the 8086/8088 was 1 Mbyte. This is why the
- address space below 1 Mbyte on a PC is so important - the
- original PCs only had this much space to work with, and
- we are still trying to use an operating system (DOS) and hardware
- architecture that was built around this processor!
-
- However, in order to attempt to remain compatible with the older
- software that ran on the 8-bit processors, Intel implemented
- what is known as their segmented memory architecture. In this
- architecture, memory addressing is no longer handled by one
- 16-bit word but two 16-bit words. One word is referred to as the
- OFFSET and the other as the SEGMENT. The entire 20-bit address
- was formed as shown below:
-
- 15 0
- ----------------
- | Segment |
- ----------------
- 15 0
- ----------------
- + | Offset |
- ----------------
- ---------------------
-
- 19 0
- --------------------
- | Physical Address |
- --------------------
-
- In words, the segment address is shifted left by 4 bits and added
- to the offset. The result is the 20-bit physical address. Note
- that for any one segment address, the offset address allows a
- 64 Kbyte "segment" of the entire 20-bit address space. Thus
- the "segment size" on the 8086/88 is 64 Kbytes.
-
- It was at this point in microprocessor evolution that the
- EMS (expanded memory system) came into being. The problem
- was that some software wanted to access more than 1 Mbyte
- of memory. Using this scheme required a special board
- with extra memory. Basically, what the EMS spec does is
- take a chunk of physical memory (a page frame) and map it into
- the memory on the board based on a mapping register.
- For example, a 64K chunk of memory from E0000 to EFFFF
- could reside in any of 16 locations in an extra 1 Mbyte
- EMS board (16*64K = 1Mbyte). Thus the mapping register
- size would be 4 bits (2^4=16).
-
- A few years later (I'm not sure when, maybe 1983?) Intel
- came out with the 80286. This processor had a 16-bit data bus
- and a 24-bit address bus. This means it was capable of accessing
- 2^24 = 16 Mbytes of physical memory. It still had the 16-bit
- segment and offset registers, but they were used in a different way.
- The segment register, instead of being used directly for the
- physical address, pointed to a "descriptor" in a "descriptor
- table". Basically, the descriptor provided a 24-bit base
- address which the offset was added to in order to form
- the final 24-bit physical address. Since the offset register
- is still 16 bits, the segment size on an 80286 is still
- 64 Kbytes.
-
- Finally we come to the current day and age with the 80386
- and higher processors. These processors have a 32-bit address
- bus, allowing 4 gigabytes of physical memory to be accessed.
- (Actually, I think the Pentium Pro has a 36-bit address
- bus, allowing 64 gigabytes of physical memory to be accessed.)
- They also have a segment and offset register, but the offset
- register is now 32-bits wide. The segment register again
- addresses a descriptor in a descriptor table, but this
- descriptor contains a 32-bit base address and some bits
- indicating the size of the segment. Thus the segment
- size can vary, and it is possible with these processors to
- have a "flat" address space of 4 gigabytes (one segment of
- size 4 gigs). In this configuration, the "near/far" pointer
- combobulations we have had to deal with go away - all pointers
- are the same (32-bits) and can point anywhere in the task's
- address space.
-
- Now you have heard of "real mode", "standard mode", "386 Enhanced
- Mode", "16-bit protected mode", and "32-bit protected mode",
- have you not? Well, real mode is the memory mode of the original
- 8086/8088 (1 Mbyte address space) and is the mode DOS always
- executes in. "16-bit protected mode" is the protected memory mode
- of the 286 microprocessor, and "32-bit protected mode" is the protected
- memory mode of the 386 and higher microprocessors. In addition, any
- x86 processor can emulate an earlier y86 processor's memory mode. For
- example, a 386 can run in real mode (and it does when running DOS).
-
- Windows 3.x running in "386 enhanced mode" uses "16-bit protected
- mode" but since any 386 or higher processor has another level of
- address translation (paging), it can utilize memory above the 16 MB
- mark. Windows NT and Windows 95 use 32-bit protected mode.
-
- --
- % Randy Yates % "...the answer lies within your soul
- % EE/Mathematics Student % 'cause no one knows which side
- % University of South Florida % the coin will fall."
- % <yatesc@csee.usf.edu> % 'Big Wheels', *Out of the Blue*, ELO
-
-